package cn.lds.j368.dsbank.domain;

import com.baomidou.mybatisplus.annotation.*;

import java.util.Date;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import javax.validation.constraints.Pattern;

/**
 * <p>
 * 客户表
 * </p>
 *
 * @author Christopher
 * @since 2023-04-04
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("t_customer")
public class Customer implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键id
     */
    @Null(message = "主键在表单提交时必须为空")
      @TableId(value = "CUSTOMER_ID", type = IdType.AUTO)
    private Long customerId;

    /**
     * 客户姓名
     */
    @NotBlank(message = "客户名不能为空")
    private String customerName;

    /**
     * 客户类型
     */
    @NotNull(message = "客户类型不能为空")
    @TableField("CUSTOMER_TYPE_id")
    private Integer customerTypeId;

    /**
     * 客户教育程度
     */
    private Integer educationId;

    /**
     * 客户证件类型
     */
    @NotNull(message = "身份类型不能为空")
    private Integer certificateTypeId;

    /**
     * 客户证件照片
     */
    private String certificateImgUrl;

    /**
     * 证件号码
     */
    @NotBlank(message = "没有获取身份证号码")
    @Pattern(regexp = "^(\\d{6})(\\d{4})(\\d{2})(\\d{2})(\\d{3})([0-9]|X)$",message = "身份证号不合法")
    private String certificateNo;

    /**
     * 对应省份id
     */
    @NotNull(message = "地址不完全")
    private Integer pId;

    /**
     * 对应城市id
     */
    @NotNull(message = "地址不完全")
    private Integer cId;

    /**
     * 对应 区/市/县ID
     */
    @NotNull(message = "地址不完全")
    private Integer tId;

    /**
     * 联系电话
     */
    @Pattern(regexp = "^1[35678]\\d{9}$", message = "手机号格式不正确")
    private String telNo;

    /**
     * 家庭住址
     */
    @Length(min = 5,max = 25,message = "地址格式不正确")
    private String homeAddress;

    /**
     * 所在单位名称
     */
    private String coName;

    /**
     * 所在单位地址
     */
    private String coAddress;

    @TableField("CREATE_EMP_Id")
    private Integer createEmpId;

    @TableField("MODIFY_EMP_id")
    private Integer modifyEmpId;

    private Date modifyTime;

    private Date createTime;

    @TableLogic  //定义逻辑删除 默认0为没有删除 1是已删除
    private Integer isDeleted;


    //封装数据字典相关类型
    @TableField(exist = false)
    DataDictionary customerType;

    @TableField(exist = false)
    DataDictionary educationType;

    @TableField(exist = false)
    DataDictionary certificateType;

    //封装地址相关类型
    @TableField(exist = false)
    ProvinceCityDistrict province;
    @TableField(exist = false)
    ProvinceCityDistrict city;

    @TableField(exist = false)
    ProvinceCityDistrict town;

    @TableField(exist = false)
    //封装添加人和修改人信息
    Employee createEmp;

    @TableField(exist = false)
    Employee modifyEmp;




}
